package STUDENT.TRINHQUANGXUANDUC.OPPS.CALCULATOR;

public class Models {
	public double Tinhtoan(CalculatorObject object) {
		double kq = 0;
		if (object.getIopt() == 1) {
			kq = object.getA() + object.getB();
		}
		if (object.getIopt() == 2) {
			kq = object.getA() - object.getB();
		}
		if (object.getIopt() == 3) {
			kq = object.getA() * object.getB();
		}
		if (object.getIopt() == 4) {
			kq = object.getA() / object.getB();
		}
		return kq;
	}

	public boolean Kiemtrachiacho0(CalculatorObject object) {
		if (object.getA() != 0 && object.getB() == 0) {
			return false;
		}

		return true;
	}

	public boolean Kiemtraso0(CalculatorObject object) {
		if (object.getA() == 0 && object.getB() == 0) {
			return false;
		}
		return true;
	}
}
